.global main
.section .data
.section .rodata
	.LC0: .string "the reciprocal square root of %f is %f\n"
	.LC1:
        .long   1031798784

invSqrt:
	push %ebp
	movl %esp, %ebp
	pushl %edx
	// 给局部变量腾空间
	subl $4, %esp
	// 取参数x的地址
	leal 8(%ebp), %eax
	// 把eax指向的内存数据放到局部变量i中
	// 由此可见，汇编中对C语音的*(int*)&x处理还是比较简单的，不用类型转换
	movl (%eax), %eax
	movl %eax, -4(%ebp)
	movl -4(%ebp), %eax
	sarl %eax
	movl %eax, %edx
	movl $1597463007, %eax
	subl %edx, %eax
	movl %eax, -4(%ebp)
	flds (%eax)
	fstps 8(%ebp)
	flds 8(%ebp)
	popl %edx
	leave
	ret
	
main:
	pushl %ebp
	movl %esp, %ebp

	subl    $20, %esp
    flds    .LC1
    fstps   -12(%ebp)
    pushl   -12(%ebp)
    call    invSqrt
    addl    $4, %esp
    fstps   -16(%ebp)
    flds    -12(%ebp)
    flds    -16(%ebp)
    subl    $12, %esp
    leal    -8(%esp), %esp
    fstpl   (%esp)
    leal    -8(%esp), %esp
    fstpl   (%esp)
    pushl   $.LC0
    call    printf
    addl    $32, %esp
	movl $0, %eax
	leave
	ret
	
	
	